<?php
/**
 * This contains the splash screen
 */
/**
 * This class is the splash screen that pop-up when the app start
 */
class SplashScreen 
{
    public function __construct()
    {    
        $this->MainWindow = new Gtkwindow(GTK_WINDOW_POPUP);
        $this->MainWindow->set_default_size(500,300);
        $this->MainWindow->set_title('PhpGtkEditor');
        $this->MainWindow->set_position(Gtk::WIN_POS_CENTER);
        $this->MainWindow->set_modal(TRUE);
        $this->MainWindow->connect('delete-event',array($this,'tentafecharLogin'));
        $PixStart = GdkPixbuf::new_from_file('start_new.xpm');
        $imagem = new GtkImage;
        $imagem->set_from_pixbuf($PixStart);
        
        $fixed = new GtkFixed;
        $this->MainWindow->add($fixed);
        $this->MainWindow->show_all();
                  
        $fixed->put($imagem, 0, 0);
        
        $aLanguages = array('English', 'Portugues');
        
        $this->Languages = &new GtkCombo();
        $this->Languages->set_size_request(120,40);
        $EntryA = $this->Languages->entry;
        $EntryA->set_editable(false);
        $EntryA->set_text($Language);
        $this->Languages->set_border_width(4);
        $this->Languages->set_popdown_strings($aLanguages);
        if ($Language) {
            $EntryA->set_text($Language);
        }
        $fixed->put($this->Languages, 368, 170);
        $array1 = array("No theme");

        $aThemes = array_merge($array1, GetSimpleDirArray('themes', true, null));	
        $this->Themes = &new GtkCombo();
        $this->Themes->set_size_request(120,40);
        $EntryB = $this->Themes->entry;
        $EntryB->set_text($Theme);
        $EntryB->set_editable(false);
        $this->Themes->set_border_width(4);
        $this->Themes->set_popdown_strings($aThemes);
        if ($Theme) {
            $EntryB->set_text($Theme);
        }
        $fixed->put($this->Themes, 368, 220);
        
        $button = new GtkButton('  OK  ');
        $button->connect('clicked', array(&$this, 'start'), $argv);
        $fixed->put($button, 444, 260);
        
        $button2 = new GtkButton(' ' . _a('Close') .  ' ');
        $button2->connect('clicked', array(&$this, 'close'));
        $fixed->put($button2, 354, 260);
        $this->MainWindow->show_all();
        Gtk::main();
    }

    public function start()
    {
        Gtk::main_quit();
    }

    public function close() 
    { 
        $app = Application::singleton();
        $app->quit();
    }
}
?>
